<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true" CodeFile="FeeType.aspx.cs" Inherits="FeeType" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <strong><span style="font-size: 32pt">FeeType Manager<br />
    </span></strong>
    <br />
    <asp:Label ID="Label1" runat="server" ForeColor="Red"></asp:Label><br />
    <table style="width: 405px">
        <tr>
            <td style="width: 100px">
                First Area:</td>
            <td style="width: 100px">
                <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1"
                    DataTextField="Location" DataValueField="Pincode">
                </asp:DropDownList><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Con %>"
                    SelectCommand="SELECT * FROM [Area]"></asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <td style="width: 100px">
                Second Area:</td>
            <td style="width: 100px">
                <asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="SqlDataSource1"
                    DataTextField="Location" DataValueField="Pincode">
                </asp:DropDownList></td>
        </tr>
        <tr>
            <td style="width: 100px; height: 2px">
                Fee:</td>
            <td style="width: 100px; height: 2px">
                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td>
        </tr>
        <tr>
            <td style="width: 100px">
            </td>
            <td style="width: 100px">
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
                    ErrorMessage="Fee cannot be blank"></asp:RequiredFieldValidator></td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Add new FeeType" /></td>
        </tr>
    </table>
    <br />
    <strong><span style="font-size: 16pt">Fee type list:</span></strong><br />
    <br />
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="3"
        ForeColor="Black" GridLines="Vertical" DataKeyNames="FeeTypeID" DataSourceID="SqlDataSource2" BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px">
        <Columns>
            <asp:BoundField DataField="FeeTypeID" HeaderText="FeeTypeID" InsertVisible="False"
                ReadOnly="True" SortExpression="FeeTypeID" />
            <asp:BoundField DataField="FirstArea" HeaderText="FirstArea" SortExpression="FirstArea" />
            <asp:BoundField DataField="SecondArea" HeaderText="SecondArea" SortExpression="SecondArea" />
            <asp:BoundField DataField="Fee" HeaderText="Fee" SortExpression="Fee" />
            <asp:CommandField ShowEditButton="True" />
            <asp:CommandField ShowDeleteButton="True" />
        </Columns>
        <FooterStyle BackColor="#CCCCCC" />
        <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="#CCCCCC" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:Con %>"
        DeleteCommand="DELETE FROM [Feetype] WHERE [FeeTypeID] = @FeeTypeID" InsertCommand="INSERT INTO [Feetype] ([FirstArea], [SecondArea], [Fee]) VALUES (@FirstArea, @SecondArea, @Fee)"
        SelectCommand="SELECT * FROM [Feetype]" UpdateCommand="UPDATE [Feetype] SET [FirstArea] = @FirstArea, [SecondArea] = @SecondArea, [Fee] = @Fee WHERE [FeeTypeID] = @FeeTypeID">
        <DeleteParameters>
            <asp:Parameter Name="FeeTypeID" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="FirstArea" Type="Int32" />
            <asp:Parameter Name="SecondArea" Type="Int32" />
            <asp:Parameter Name="Fee" Type="Decimal" />
            <asp:Parameter Name="FeeTypeID" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="FirstArea" Type="Int32" />
            <asp:Parameter Name="SecondArea" Type="Int32" />
            <asp:Parameter Name="Fee" Type="Decimal" />
        </InsertParameters>
    </asp:SqlDataSource>
</asp:Content>

